SET NAMES utf8mb4;
BEGIN;

-- 创建菜单
INSERT INTO `system_permission` (`code`, `name`, `remark`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES ('system:location:query', '查询', '', 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `system_menu` (`parent_id`, `permission_id`, `name`, `type`, `uri`, `remark`, `icon_id`, `disabled`, `sort`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES (null, (SELECT MAX(`id`) FROM system_permission), '地区管理', 'SYSTEM', '/system/location', '', null, 0, 1, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);

-- 创建菜单和权限
INSERT INTO `system_permission` (`code`, `name`, `remark`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES ('system:location:create', '新建', '', 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `system_menu_func` (`menu_id`, `permission_id`, `name`, `remark`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES ((SELECT MAX(`id`) FROM system_menu), (SELECT MAX(`id`) FROM system_permission), '新建', '', 1, CURRENT_TIMESTAMP, NULL, NULL, 0);

INSERT INTO `system_permission` (`code`, `name`, `remark`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES ('system:location:delete', '删除', '', 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `system_menu_func` (`menu_id`, `permission_id`, `name`, `remark`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES ((SELECT MAX(`id`) FROM system_menu), (SELECT MAX(`id`) FROM system_permission), '删除', '', 1, CURRENT_TIMESTAMP, NULL, NULL, 0);

INSERT INTO `system_permission` (`code`, `name`, `remark`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES ('system:location:update', '修改', '', 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
INSERT INTO `system_menu_func` (`menu_id`, `permission_id`, `name`, `remark`, `created_by`, `created_at`, `updated_by`, `updated_at`, `deleted`) VALUES ((SELECT MAX(`id`) FROM system_menu), (SELECT MAX(`id`) FROM system_permission), '更新', '', 1, CURRENT_TIMESTAMP, NULL, NULL, 0);

COMMIT;
